<div id="pageoptions">
    
    <% @links = "" 
        if @story then 
            @links += link_to "< back to shared word list", {# link_to options
                        :controller => 'word',
                        :action => 'shared_words' }
        else
            @links += link_to "< back to shared words list", {# link_to options
                        :controller => 'word',
                        :action => 'shared_words' }
        end %>
    <% 
        if params[:relationship_id] then 
            @links += " | "
            @links += link_to "< back to #{@owner.first_name} #{@owner.last_name}'s shared word list", {# link_to options
                        :controller => 'word',
                        :action => 'shared_words',
                        :relationship_id => params[:relationship_id]}
        end
    %>
    
    <%= @links %>
</div>
<div class="sectionwrap">
    <% if @story then %>
    <div class="sectiontitle">
    Words from <%= link_to "#{@story.title}", {# link_to options
            :controller => 'story',
            :action => 'view',
            :id => @story.id,
            :relationship_id => params[:relationship_id] } %></div>
    <div class="storydates">Created: <%= h(@story.created_at.strftime(" %m/%d/%Y %I:%M%p")) %>  <%= if @story.updated_at then 
                                                                                                                "Modified: #{h(@story.updated_at.strftime(' %m/%d/%Y %I:%M%p'))}"
                                                                                                            end %></div>                                                                                                          
    <% end %>
    <% for word in @words %>
        <div class="studypagination">
            <% if @word_pages.length > 1 then  %>
                <% if @story then %>
                        <%= if !@word_pages.current.first? then link_to "&lt; Prev", :page=> @word_pages.current.previous, :params => {:story_id => @story.id, :relationship_id => params[:relationship_id] } else "&lt; Prev" end %> 
                        <%= if !@word_pages.current.last? then link_to "Next &gt;", :page=> @word_pages.current.next, :params => {:story_id => @story.id, :relationship_id => params[:relationship_id]} unless @word_pages.current.last? else "Next &gt;" end %>
                <% else %>
                        <%= if !@word_pages.current.first? then link_to "&lt; Prev", :page=> @word_pages.current.previous,:params => {:relationship_id => params[:relationship_id]} else "&lt; Prev" end %> 
                        <%= if !@word_pages.current.last? then link_to "Next &gt;", :page=> @word_pages.current.next,:params => {:relationship_id => params[:relationship_id]} else "Next &gt;" end %>
                <% end %>
            <% end %>
        </div>
        <div id="onewordwrap">
            <span class="oneword"><%= word.word.chomp %></span>
            <p>
            <% if @story %>
                <%= link_to "exclude word", {# link_to options
                                    :controller => 'dud',
                                    :action => 'exclude_word',
                                    :word => h(word.word),
                                    :relationship_id => params[:relationship_id],
                                    :shared => params[:shared],
                                    :story_id => @story.id},
                                    {:class => "optionlink"
                                    }  %> 
            <% else %>
                <%= link_to "exclude word", {# link_to options
                                        :controller => 'dud',
                                        :action => 'exclude_word',
                                        :word => h(word.word),
                                        :relationship_id => params[:relationship_id],
                                        :shared => params[:shared]},
                                        {:class => "optionlink"
                                        }  %> 
            <% end %>
            </p>
        </div>
        
    <% end %>
</div>